<template>
  <div class="app-container">
    <el-tabs type="card" v-model="activeName">
      <el-tab-pane label="地图" name="first" v-loading="loading">
        <!--地图-->
        <EarthquakeInfluenceMap v-if="completeRefreshInfluence==true"
          @mapLoading="mapLoading"
          @returnSetPage="returnSetPage"
          @getMap="getMap" @getSelectFeatureProperties="getSelectFeatureProperties" @getClickCoordinate="getClickCoordinate" @showBaseDataLayerControl="showBaseDataLayerControl"
          @showInfluenceEvent="showInfluenceEvent"
          @showSeismicCapacityDistributionLayer="showSeismicCapacityDistributionLayer"
          @showCountyDeathDiff="showCountyDeathDiff"
          @showEvaluateResultSelect="showEvaluateResultSelect"
          @showEvaluateResultEvent="showEvaluateResultEvent"

          :allSettingData="allSettingData"
          :taskRegion="taskRegion"
          :influenceEllipseList="influenceEllipseList"
          :seismicCapacityDistributionListData="seismicCapacityDistributionListData"
          :capacityLegendData="capacityLegendData"
          :countyDeathDiffListData="countyDeathDiffListData"
          :countyDeathDiffLegendData="countyDeathDiffLegendData"
          :evaluateResultLayerSelectType="evaluateResultLayerSelectType"
          :evaluateResultListData="evaluateResultListData"
          :evaluateResultLegendData="evaluateResultLegendData"
          :showLayerType="showLayerType"
          :countyLandslideListData="countyLandslideListData"
          :countyLandslideLegendData="countyLandslideLegendData"
          :countyLandslideBufferList="countyLandslideBufferList"
        ></EarthquakeInfluenceMap>
        <!--基础数据图层组件-->
        <BaseDataLayer v-if="completeRefreshInfluence==true"
           :map="map"
           :selectFeatureProperties="selectFeatureProperties"
           :clickCoordinate="clickCoordinate"
           :showHideBaseDataLayerDivBool="showHideBaseDataLayerDivBool"
           :taskDistrict="taskDistrict"
        >
        </BaseDataLayer>
        <!--超图图层显示-->
        <SuperMapLayer v-if="completeRefreshInfluence==true"
                       :map="map" :layerDataTypeList="layerDataTypeList"
                       :resetClearAllBool="resetClearAllBool"
                       :clickLonLat="clickCoordinate"
        ></SuperMapLayer>
        <!--选择影响场震级和角度面板-->
        <div v-if="levelAngleDivBool" class="earthquakeLevelAngleRadioSelectDiv">
          <el-form key="formFaultKey" :model="settingSeismic" label-position="left" label-width="50px">
            <el-form-item label="震级" prop="isMagnitude" style="margin-bottom: 15px;">
              <el-radio-group v-model="levelSelect" @change="radioSelect">
                <el-radio v-for="item in levelData" :key="item" :label="item" :value="item">
                  {{item}}级
                </el-radio>
              </el-radio-group>
            </el-form-item>
            <el-form-item label="角度" prop="angle" style="margin-bottom: 0px;">
              <el-radio-group v-model="angleSelect" @change="radioSelect">
                <el-radio v-for="item in angleData" :key="item" :label="item" :value="item">
                  {{item}}度
                </el-radio>
              </el-radio-group>
            </el-form-item>
          </el-form>
        </div>
        <!--地震影响场图层图例-->
        <div v-if="showInfluenceEllipseBool==true" class="new-evaluateResultDiv">
          <div style="text-align: center;">
            <span style="font-size: 14px;font-weight: bold;color: rgb(16, 124, 229);">图例</span>
          </div>
          <div style="text-align: center;height: 20px;">
            <span style="font-size: 14px;font-weight: bold;color: rgb(16, 124, 229);">地震影响场烈度</span>
          </div>
          <template v-for="item in influenceEllipseLegendData">
            <div>
              <div><div style="border-color:rgb(152,152,152);" :style="{'background-color': item.color}" class="new-legendDiv-polygon"></div></div>
              <span>{{ item.name }}</span>
            </div>
          </template>
        </div>
        <!--设定地震图例-->
        <div class="new-setEarthquakeLegendDiv">
          <div style="text-align: center;">
            <span style="font-size: 14px;font-weight: bold;color: rgb(16, 124, 229);">图例</span>
          </div>
          <div>
            <div><div style="border-color:orange;" :style="{'background-color': 'rgba(255,255,255,0)'}" class="new-legendDiv-polygon"></div></div>
            <span>任务区域</span>
          </div>
          <div>
            <div><div style="border-color:black;" :style="{'background-color': 'red'}" class="new-legendDiv-polygon"></div></div>
            <span>设定地震</span>
          </div>
        </div>
        <!--选择评估结果震级和角度面板-->
        <div v-if="levelAngleEvaluateResultDivBool" class="earthquakeLevelAngleRadioSelectDiv">
          <el-form key="formFaultKey" :model="settingSeismic" label-position="left" label-width="50px">
            <el-form-item label="震级" prop="isMagnitude" style="margin-bottom: 15px;">
              <el-radio-group v-model="levelSelect" @change="radioEvaluateResultSelect">
                <el-radio v-for="item in levelData" :key="item" :label="item" :value="item">
                  {{item}}级
                </el-radio>
              </el-radio-group>
            </el-form-item>
            <el-form-item v-if="angleEvaluateResultBool" label="角度" prop="angle" style="margin-bottom: 0px;">
              <el-radio-group v-model="angleSelect" @change="radioEvaluateResultSelect">
                <el-radio v-for="item in angleData" :key="item" :label="item" :value="item">
                  {{item}}度
                </el-radio>
              </el-radio-group>
            </el-form-item>
          </el-form>
        </div>
        <!--评估结果图层选择-->
        <div v-if="showHideEvaluateResultLayerDivBool==true" class="new-layerSelectDiv" style="top:320px;">
          <el-cascader v-model="evaluateResultLayerSelectData" placeholder="请选择图层"
                       :options="evaluateResultLayerOptions" :props="evaluateResultLayerProps" @change="chooseEvaluateResultLayers"
                       separator="," collapse-tags collapse-tags-tooltip clearable></el-cascader>
        </div>
        <!--评估结果图层图例-->
        <div v-if="showEvaluateResultBool==true" class="new-evaluateResultDiv">
          <div style="text-align: center;">
            <span style="font-size: 14px;font-weight: bold;color: rgb(16, 124, 229);">图例</span>
          </div>
          <div style="text-align: center;height: 20px;">
            <span style="font-size: 14px;font-weight: bold;color: rgb(16, 124, 229);">{{ evaluateResultLegendTitle }}</span>
          </div>
          <template v-if="evaluateResultLayerSelectType!=''" v-for="item in evaluateResultLegendData">
            <div>
              <div><div style="border-color:gray;" :style="{'background-color': item.color}" class="new-legendDiv-polygon"></div></div>
              <span>{{ item.name }}</span>
            </div>
          </template>
        </div>
        <!--评估结果烈度面板-->
        <div v-if="evaluateResultLayerSelectType=='人员死亡分布图（修正前）' || evaluateResultLayerSelectType=='经济损失分布图（修正前）' || evaluateResultLayerSelectType=='需紧急安置人数分布图（修正前）'"
             class="earthquakeLevelAngleRadioSelectDiv" style="width:386px;">
          <div style="text-align: center;">
            <span style="font-size: 14px;font-weight: bold;color: rgb(16, 124, 229);">烈度选择</span>
          </div>
          <el-radio-group v-model="intensitySelect" @change="radioEvaluateDistributionIntensitySelect">
            <el-radio v-for="item in intensityLegendData" :key="item.value" :label="item.value" :value="item.value">
              {{item.name}}
            </el-radio>
          </el-radio-group>
          <div style="text-align: center;">
            <span style="font-size: 14px;font-weight: bold;color: rgb(16, 124, 229);">按区县或乡镇统计</span>
          </div>
          <p>
            <el-button type="primary" @click="countPbeEvent('0')">按区县统计</el-button>
            <el-button type="primary" @click="countPbeEvent('1')">按乡镇统计</el-button>
          </p>
        </div>
        <!--评估结果按区县、乡镇统计表-->
        <div class="new-queryResultDiv" v-if="countPbeBool">
          <div style="position: absolute;top: 0px;height: 50px;width: 100%;padding: 13px;text-align: center;">
            <span style="font-size: 18px;font-weight: bold;color: rgb(16, 124, 229);">统计结果表</span>
          </div>
          <div class="new-queryTableBtn">
            <el-button @click="countPbeBool=false" type="primary">关闭</el-button>
          </div>
          <div class="new-queryTableDiv">
            <el-table :data="countPbeListData" ref="countPbeTable" border
                      height="149" stripe :header-cell-style="{textAlign:'center'}" :cell-style="{textAlign:'center'}" style="width: 100%">
              <el-table-column v-if="countPbeType=='0'" key="county" prop="county" label="区县"></el-table-column>
              <el-table-column v-else key="town" prop="town" label="乡镇"></el-table-column>
              <el-table-column v-if="evaluateResultLayerSelectType=='人员死亡分布图（修正前）'" key="sumInjuries" prop="sumInjuries" label="死亡人数（人）"></el-table-column>
              <el-table-column v-if="evaluateResultLayerSelectType=='经济损失分布图（修正前）'" key="sumLosses" prop="sumLosses" label="经济损失（万元）"></el-table-column>
              <el-table-column v-if="evaluateResultLayerSelectType=='需紧急安置人数分布图（修正前）'" key="sumPlant" prop="sumPlant" label="需紧急安置人数（人）"></el-table-column>
            </el-table>
          </div>
        </div>
        <!--抗震能力分布图层图例-->
        <div v-if="showSeismicCapacityDistributionBool==true" class="new-capacityLegendDiv">
          <div style="text-align: center;">
            <span style="font-size: 14px;font-weight: bold;color: rgb(16, 124, 229);">图例</span>
          </div>
          <div style="text-align: center;height: 20px;">
            <span style="font-size: 14px;font-weight: bold;color: rgb(16, 124, 229);">建筑物综合抗震能力</span>
          </div>
          <template v-for="item in capacityLegendData">
            <div>
              <div><div style="border-color:gray;" :style="{'background-color': item.color}" class="new-legendDiv-polygon"></div></div>
              <span>{{ item.name }}</span>
            </div>
          </template>
        </div>
        <!--抗震能力分布烈度面板-->
        <div v-if="showSeismicCapacityDistributionBool==true" class="earthquakeLevelAngleRadioSelectDiv" style="width:386px;">
          <div style="text-align: center;">
            <span style="font-size: 14px;font-weight: bold;color: rgb(16, 124, 229);">结果类型选择</span>
          </div>
          <el-radio-group v-model="capacityDistributionType" @change="radioIntensitySelect">
            <el-radio v-for="item in capacityDistributionTypeData" :key="item.value" :label="item.value" :value="item.value">
              {{item.name}}
            </el-radio>
          </el-radio-group>
          <div style="text-align: center;">
            <span style="font-size: 14px;font-weight: bold;color: rgb(16, 124, 229);">烈度选择</span>
          </div>
          <el-radio-group v-model="intensitySelect" @change="radioIntensitySelect">
            <el-radio v-for="item in intensityLegendData" :key="item.value" :label="item.value" :value="item.value">
              {{item.name}}
            </el-radio>
          </el-radio-group>
        </div>
        <!--区县、乡镇抗震能力分布表-->
        <!--<div class="new-queryResultDiv" v-if="showSeismicCapacityTable && (capacityDistributionType=='0' || capacityDistributionType=='1')">
          <div class="new-queryTableBtn">
            <el-button @click="showSeismicCapacityTable=false" type="primary">关闭</el-button>
          </div>
          <div class="new-queryTableDiv">
            <el-table :data="seismicCapacityDistributionListData" ref="seismicCapacityDistributionTable" border
                      height="149" stripe :header-cell-style="{textAlign:'center'}" :cell-style="{textAlign:'center'}" style="width: 100%">
              <el-table-column v-if="capacityDistributionType=='0'" key="county" prop="county" label="区县"></el-table-column>
              <el-table-column v-else key="town" prop="town" label="乡镇"></el-table-column>
              <el-table-column key="seismicCapacityValue" prop="seismicCapacityValue" label="抗震能力"></el-table-column>
            </el-table>
          </div>
        </div>-->
        <!--区县致死性差异性分布图例-->
        <div v-if="showCountyDeathDiffBool==true" class="new-capacityLegendDiv">
          <div style="text-align: center;">
            <span style="font-size: 14px;font-weight: bold;color: rgb(16, 124, 229);">图例</span>
          </div>
          <div style="text-align: center;height: 20px;">
            <span style="font-size: 14px;font-weight: bold;color: rgb(16, 124, 229);">区县致死性差异性分布</span>
          </div>
          <template v-for="item in countyDeathDiffLegendData">
            <div>
              <div><div style="border-color:gray;" :style="{'background-color': item.color}" class="new-legendDiv-polygon"></div></div>
              <span>{{ item.name }}</span>
            </div>
          </template>
        </div>
        <!--震后交通情况分布图图例-->
        <div v-if="showCountyLandslideBool==true" class="new-capacityLegendDiv" style="width:180px;">
          <div style="text-align: center;">
            <span style="font-size: 14px;font-weight: bold;color: rgb(16, 124, 229);">图例</span>
          </div>
          <div style="text-align: center;height: 20px;">
            <span style="font-size: 14px;font-weight: bold;color: rgb(16, 124, 229);">震后交通情况分布图</span>
          </div>
          <template v-for="item in countyLandslideLegendData0">
            <div>
              <div><div :style="{'background-color': item.color}" class="new-legendDiv-line"></div></div>
              <span>{{ item.name }}</span>
            </div>
          </template>
          <template v-for="item in countyLandslideLegendData" v-if="countLandslideType=='逻辑斯蒂模型计算滑坡等级'">
            <div>
              <div><div :style="{'background-color': item.color,'border-color': item.color}" class="new-legendDiv-polygon"></div></div>
              <span>{{ item.name }}</span>
            </div>
          </template>
          <template v-for="item in countyLandslideLegendData1" v-if="countLandslideType=='黄土高原模型计算滑坡等级'">
            <div>
              <div><div :style="{'background-color': item.color,'border-color': item.color}" class="new-legendDiv-polygon"></div></div>
              <span>{{ item.name }}</span>
            </div>
          </template>
        </div>
        <!--震后交通情况分布图控制按钮面板-->
        <div v-if="showCountyLandslideBool==true" class="earthquakeLevelAngleRadioSelectDiv" style="width: 390px;">
          <div style="text-align: center;">
            <span style="font-size: 14px;font-weight: bold;color: rgb(16, 124, 229);">震后交通情况分布图烈度选择</span>
          </div>
          <el-radio-group v-model="dzIntensitySelect" @change="radioEvaluateDzIntensitySelect" style="margin-bottom:10px;">
            <el-radio v-for="item in dzIntensityLegendData" v-show="item.show" :key="item.value" :label="item.value" :value="item.value" :disabled="item.noDataBool">
              {{item.name}}
            </el-radio>
          </el-radio-group>
          <el-button type="primary" @click="showCountyLandslideRoadTable" :disabled="dzIntensitySelect==''">统计结果查看</el-button>
          <el-button type="primary" @click="showCountyLandslideRoadInfoDiv" :disabled="dzIntensitySelect==''">填写交通情况</el-button>
          <el-button v-if="showCountyLandslideSlopeBufferBool==false" type="primary" @click="showCountyLandslideSlopeBuffer" :disabled="dzIntensitySelect==''">查看缓冲区</el-button>
          <el-button v-else type="primary" @click="hideCountyLandslideSlopeBuffer" :disabled="dzIntensitySelect==''">隐藏缓冲区</el-button>
        </div>
        <!--震后交通情况统计表-->
        <el-dialog title="震后交通情况统计表" v-model="showCountyLandslideRoadTableBool" width="450px">
          <div style="padding-left:20px;">考虑对道路影响的范围（m）：{{ roadRange }}</div>
          <div style="padding:20px;">
            <el-table :data="countyLandslideRoadList"  stripe>
              <el-table-column property="roadType" label="类型" width="100"></el-table-column>
              <el-table-column property="roadName" label="名称" width="300"></el-table-column>
            </el-table>
          </div>
        </el-dialog>
        <!--填写交通情况面板-->
        <el-dialog title="填写交通情况" v-model="showCountyLandslideRoadInfoDivBool">
          <div style="padding:20px;">
            <el-form :model="countyLandslideTrafficAnalysisData" ref="rulesForm" label-position="right" label-width="80px">
              <el-form-item label="震后交通情况分析" prop="trafficAnalysis" :rules="rulesTrafficAnalysisData.trafficAnalysis">
                <el-input type="textarea" :rows="10" placeholder="请填写震后交通情况分析" v-model="countyLandslideTrafficAnalysisData.trafficAnalysis"></el-input>
              </el-form-item>
            </el-form>
            <div style="text-align:center;">
              <el-button type="primary" @click="saveUpdateTrafficAnalysisData">保存</el-button>
              <el-button plain @click="hideCountyLandslideRoadInfoDiv">关闭</el-button>
            </div>
          </div>
        </el-dialog>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>
<script setup name="earthquakeInfluenceflied">
//地图
import EarthquakeInfluenceMap from '@/map/earthquakeLossesEstimation/earthquakeSetting/Influenceflied/map.vue';
//基础数据地图组件
import BaseDataLayer from '@/map/components/baseDataLayer/index.vue';
import SuperMapLayer from '@/map/components/superMapLayer/index.vue';
import { getTaskInfoById,getAllCodeListByTaskId,
  getIntersectionFaultByTaskId,isTaskRegionContainsLonLat,isTaskRegionTouchesLonLat,
  createInfluenceEllipse,getResultTotalByTaskId,getResultTotalDetailByTaskIdNum,queryInfluencefliedLevelListByTaskId,
  queryInfluencefliedLevelAngleList,queryAllEvaluateResultTotalDetails,queryEvaluateResultTotalDetailsByAngle,
  queryInfluencefliedEllipse,getSeiCapCalculation,getLethalityDifferenceFinalValue,
  getYpgResultSlopeNewIntensityList,getYpgResultSlopeRoadByTaskId,getYpgResultRoadListByTaskId,getYpgResultSlopeBufferByTaskId,
  getTrafficAnalysisByTaskId,saveTrafficAnalysis,updateTrafficAnalysis,
  getPbeInjuriesByTaskIdAndIntensity,getPbeLossesByTaskIdAndIntensity,getPbeByTaskIdAndIntensity,
  countPbeInjuries,countPbeLosses,countPbePlant,
} from "@/api/earthquakeLossesEstimation/earthquakeSetting";

const route = useRoute();
const router = useRouter();
const { proxy } = getCurrentInstance();
const activeName = ref("first");
const loading = ref(false);
const taskUuid = ref("");//任务主键ID
const taskType = ref("");//任务信息类型
const pattern = ref("");//任务信息pattern
const metaTitle = ref("");//页签名称
const returnPageName = ref("");//返回设定地震页面名称
//选中的图层要素的属性
const selectFeatureProperties = ref({});
//地图选中的经纬度
const clickCoordinate = ref([]);
//是否显示基础数据图层选择控件
const showHideBaseDataLayerDivBool = ref(false);

//初始化数据
const data = reactive({
  queryParams: {//查询任务全部设定地震参数
    taskId:"",//任务主键ID
    type:"",//类型1点状2断层3公里格网,type为空则查询全部
  },
  layerDataQueryParams: {//基础数据查询参数
    province: "",
    city: "",
    county: "",
    dataType: "",//数据类型
  },
  settingSeismic: {//点状设定地震参数 | 断层设定地震参数
    earthquakeType:"1",//类型：1点状2断层3公里格网
    taskId:"",//任务ID
    ssId:"",//主键Id
    coordinates: "",//经纬度坐标,省市县,角度
    //震级
    benchmarkMagnitude: "6.0",//基准震级
    pointSeismicNumber: "3",//个数
    operationMagnitude:"0.5",//上下增减间隔
    //自定义
    determineMagnitude:"",//确认震级,
    //影响场
    isAngle:"1",//影响场角度选项：1最近断层切线角度 2指定角度
    angle:"",//最近断层切线角度或指定角度（初始角度）
    stepSize:"",//步长
    createUserId:"",//创建人Id
    createUser:"",//创建人名称
    createTime:"",//创建时间
    updateUser:"",//修改人id
    updateTime:"",//修改时间
    isDelete:"",//删除标识：0未删除，1已删除
    //断层设定地震参数
    spaceRange: "",//空间范围
    distanceFault:"0.0",//与断层起始点距离
    intervalFault:"30",//按断层生成间隔(公里)
  },
  countyLandslideTrafficAnalysisData:{//震后交通情况分析
    uuid:"",//主键id
    trafficAnalysis:"",//震后交通情况分析
    taskId:"",//任务id
    createUserId:"",//创建人Id
    createUser:"",//创建人名称
    createTime:"",//创建时间
    updateUser:"",//修改人id
    updateTime:"",//修改时间
    isDelete:"",//删除标识：0未删除，1已删除
    dzIntensity:"",//地震烈度6-11
  },
  rulesTrafficAnalysisData:{//校验震后交通情况分析
    trafficAnalysis: [{ required: true, message: "请填写震后交通情况分析", trigger: "blur" }],
  },
  //图层数据类别code和url列表
  layerDataTypeList:[
    {
      //震后交通情况分布图
      level2DataType:"eqTrafficCount",//数据类别二级code
      level3DataType:"eqTrafficSlope",//数据类别三级code
      versionCode:null,//查询临时图层过滤条件
      show:false,//是否显示
      isYw:true,//是否为业务系统数据，true业务系统，false基础数据系统
      tifFileName:null,//tif文件名称
    },
  ],
});
let {
  queryParams,
  layerDataQueryParams,
  settingSeismic,
  countyLandslideTrafficAnalysisData,
  rulesTrafficAnalysisData,
  layerDataTypeList
} = toRefs(data);

//设定地震地震影响场--start
const allSettingData = ref([]);//全部设定地震图层数据
const addressDataStrArray = ref([]);//经纬度点地址解析数组:省,市,县
const taskDistrict = ref("");//任务地区（省-市-区县、）
const taskRegion = ref("");//任务区域经纬度
const taskRegionCoordinateArray = ref([]);//任务区域经纬度数组
const influenceEllipseList = ref([]);//地震影响场椭圆环列表
const levelSelect = ref("");//震级选择
const angleSelect = ref("0");//角度选择
const lonSelect = ref("");//地震影响场中心点经度
const latSelect = ref("");//地震影响场中心点纬度
const numSelect = ref("1");//序号
const levelData = ref([]);//震级列表
const angleData = ref([]);//角度列表
const levelAngleDivBool = ref(false);//是否显示震级角度选择面板
//是否显示地震影响场图层
const showInfluenceEllipseBool = ref(false);
//地震影响场图层图例范围
const influenceEllipseLegendData = ref([
  {code:"0",name:"Ⅵ（6度）",color:"rgba(255,190,190,0.7)"},
  {code:"1",name:"Ⅶ（7度）",color:"rgba(255,127,127,0.7)"},
  {code:"2",name:"Ⅷ（8度）",color:"rgba(200,40,40,0.7)"},
  {code:"3",name:"Ⅸ（9度）",color:"rgba(168,0,0,0.7)"},
  {code:"4",name:"Ⅹ（10度）",color:"rgba(140,0,0,0.7)"},
]);
//设定地震地震影响场--end

//是否显示区县、乡镇抗震能力分布表
const showSeismicCapacityTable = ref(false);
//抗震能力分布图层结果类型：0:区县级,1:乡镇级,2:公里格网级
const capacityDistributionType = ref("0");
//抗震能力分布图层结果类型范围
const capacityDistributionTypeData = ref([
  {code:"0",name:"区（县）",value:"0"},
  {code:"1",name:"乡镇（街道）",value:"1"},
  {code:"2",name:"公里格网",value:"2"},
]);
const seismicCapacityDistributionListData = ref([]);//抗震能力分布图层查询结果数据列表
//是否显示抗震能力分布图层
const showSeismicCapacityDistributionBool = ref(false);
//抗震能力分布图层图例范围
const capacityLegendData = ref([
  {code:"0",name:"0-0.3",color:"rgba(255,0,0,0.7)"},
  {code:"1",name:"0.3-0.6",color:"rgba(255,115,0,0.7)"},
  {code:"2",name:"0.6-0.7",color:"rgba(255,203,0,0.7)"},
  {code:"3",name:"0.7-0.8",color:"rgba(211,248,0,0.7)"},
  {code:"4",name:"0.8-0.9",color:"rgba(128,246,0,0.7)"},
  {code:"5",name:"0.9-1.0",color:"rgba(17,241,5,0.7)"},
]);
//抗震能力分布--烈度选择
const intensitySelect = ref("6");
//抗震能力分布--烈度范围
const intensityLegendData = ref([
  {code:"0",name:"Ⅵ（6度）",value:"6"},
  {code:"1",name:"Ⅶ（7度）",value:"7"},
  {code:"2",name:"Ⅷ（8度）",value:"8"},
  {code:"3",name:"Ⅸ（9度）",value:"9"},
  {code:"4",name:"Ⅹ（10度）",value:"10"},
]);

const countyDeathDiffListData = ref([]);//区县致死性差异性分布查询结果数据列表
//是否显示区县致死性差异性分布
const showCountyDeathDiffBool = ref(false);
//区县致死性差异性分布图例范围
const countyDeathDiffLegendData = ref([
  {code:"0",name:"0-0.1",color:"rgba(255,0,0,0.7)"},
  {code:"1",name:"0.1-0.2",color:"rgba(255,115,0,0.7)"},
  {code:"2",name:"0.2-0.3",color:"rgba(255,203,0,0.7)"},
  {code:"3",name:"0.3-0.5",color:"rgba(211,248,0,0.7)"},
  {code:"4",name:"0.5-0.7",color:"rgba(128,246,0,0.7)"},
  {code:"5",name:"0.7-1.0",color:"rgba(17,241,5,0.7)"},
]);

//震后交通情况分布图--烈度选择
const dzIntensitySelect = ref("");//地震烈度（6-11度）
//震后交通情况分布图--烈度范围
const dzIntensityLegendData = ref([
  {code:"0",name:"Ⅵ（6度）",value:"6",noDataBool:true,show:true},
  {code:"1",name:"Ⅶ（7度）",value:"7",noDataBool:true,show:true},
  {code:"2",name:"Ⅷ（8度）",value:"8",noDataBool:true,show:true},
  {code:"3",name:"Ⅸ（9度）",value:"9",noDataBool:true,show:true},
  {code:"4",name:"Ⅹ（10度）",value:"10",noDataBool:true,show:true},
  {code:"5",name:"Ⅺ（11度）",value:"11",noDataBool:true,show:false},
]);
const countyLandslideListData = ref([]);//震后交通情况分布图数据
const countyLandslideBufferList = ref([]);//震后交通情况滑坡缓冲区数据列表
const countyLandslideRoadList = ref([]);//震后遭遇交通情况影响统计数据
const showCountyLandslideRoadTableBool = ref(false);//是否显示震后遭遇交通情况影响统计表
const showCountyLandslideRoadInfoDivBool = ref(false);//是否显示填写交通情况面板
//是否显示震后交通情况分布图
const showCountyLandslideBool = ref(false);
//震后交通情况分布图图例范围--交通类型
const countyLandslideLegendData0 = ref([
  {code:"0",name:"影响道路",color:"rgba(255,0,0,1)"},
]);
//震后交通情况分布图图例范围--滑坡等级（逻辑斯蒂模型）
const countyLandslideLegendData = ref([
  {code:"0",name:"一级：极低危险",color:"rgba(128,246,0,0.8)"},
  {code:"1",name:"二级：低危险",color:"rgba(211,248,0,0.8)"},
  {code:"2",name:"三级：中危险",color:"rgba(255,203,0,0.8)"},
  {code:"3",name:"四级：高危险",color:"rgba(255,115,0,0.8)"},
  {code:"4",name:"五级：极高危险",color:"rgba(255,0,0,0.8)"},
]);
//震后交通情况分布图图例范围--滑坡等级（黄土高原模型）
const countyLandslideLegendData1 = ref([
  {code:"0",name:"极低危险",color:"rgba(128,246,0,0.8)"},
  {code:"1",name:"低危险",color:"rgba(211,248,0,0.8)"},
  {code:"2",name:"中危险",color:"rgba(255,203,0,0.8)"},
  {code:"3",name:"高危险",color:"rgba(255,115,0,0.8)"},
]);
//震后交通情况分布图--计算滑坡等级的模型类型
const countLandslideType = ref("");//逻辑斯蒂模型计算滑坡等级、黄土高原模型计算滑坡等级

//评估结果
const showHideEvaluateResultLayerDivBool = ref(false);//是否显示评估结果图层选择面板
const evaluateResultLayerSelectData = ref([]);//评估结果图层选择内容
const evaluateResultLayerProps = ref({ multiple: false });//评估结果图层选择--是否多选
const levelAngleEvaluateResultDivBool = ref(false);//是否显示评估结果震级角度选择面板
const angleEvaluateResultBool = ref(false);//是否显示评估结果角度选择
const evaluateResultLayerSelectType = ref("");//评估结果选择类型
const evaluateResultListData = ref([]);//评估结果查询结果数据列表
const showLayerType = ref("");//显示图层类型：基础数据图层|地震影响场|抗震能力分布图层|区县致死性差异性分布|评估结果
const countPbeListData = ref([]);//评估结果按区县、乡镇统计表数据
const countPbeType = ref("0");//统计类型：0区县 1乡镇
const countPbeBool = ref(false);//是否显示评估结果按区县、乡镇统计表
//评估结果图层选择
const evaluateResultLayerOptions = ref([
  { value: '人员伤亡', label: '人员伤亡' },
  { value: '人员死亡分布图（修正前）', label: '人员死亡分布图（修正前）' },
  { value: '经济损失', label: '经济损失' },
  { value: '经济损失分布图（修正前）', label: '经济损失分布图（修正前）' },
  { value: '需紧急安置人数', label: '需紧急安置人数' },
  { value: '需紧急安置人数分布图（修正前）', label: '需紧急安置人数分布图（修正前）' },
  { value: '需救援队伍', label: '需救援队伍' },
  { value: '需医务人员', label: '需医务人员' },
  {
    value: '需救援物资',
    label: '需救援物资',
    children: [{
      value: '需帐篷数',
      label: '需帐篷数'
    }, {
      value: '需担架',
      label: '需担架',
    }, {
      value: '需棉被',
      label: '需棉被',
    }, {
      value: '需食品',
      label: '需食品',
    }, {
      value: '需饮水',
      label: '需饮水',
    }, {
      value: '需临时厕所',
      label: '需临时厕所',
    }, {
      value: '需临时浴室',
      label: '需临时浴室',
    }]
  },
  { value: '需医疗物资', label: '需医疗物资' },
  { value: '震后交通情况分布图', label: '震后交通情况分布图' },
]);

//是否显示评估结果图层
const showEvaluateResultBool = ref(false);
const evaluateResultLegendTitle = ref("");//评估结果图例名称
//评估结果图层图例范围
const evaluateResultLegendData = ref([]);
//评估结果图层图例范围1--人员伤亡
const evaluateResultLegendData1 = ref([
  {code:"0",name:"死亡人数",color:"red"},
  {code:"1",name:"受伤人数",color:"blue"},
]);
//评估结果图层图例范围2--经济损失
const evaluateResultLegendData2 = ref([
  {code:"0",name:"经济损失（亿元）",color:"red"},
]);
//评估结果图层图例范围3--需紧急安置人数
const evaluateResultLegendData3 = ref([
  {code:"0",name:"需紧急安置人数",color:"red"},
]);
//评估结果图层图例范围4--需救援队伍
const evaluateResultLegendData4 = ref([
  {code:"0",name:"专业救援力量（人）",color:"red"},
  {code:"1",name:"民间救援力量（人）",color:"blue"},
  {code:"2",name:"社会其他救援力量（人）",color:"orange"},
]);
//评估结果图层图例范围5--需医务人员
const evaluateResultLegendData5 = ref([
  {code:"0",name:"医生（人）",color:"red"},
  {code:"1",name:"护士（人）",color:"blue"},
  {code:"2",name:"心理医生（人）",color:"orange"},
]);
//评估结果图层图例范围6--需救援物资--需帐篷数
const evaluateResultLegendData6_1 = ref([
  {code:"0",name:"需帐篷数（顶）",color:"red"},
]);
//评估结果图层图例范围6--需救援物资--需担架
const evaluateResultLegendData6_2 = ref([
  {code:"0",name:"需担架（付）",color:"red"},
]);
//评估结果图层图例范围6--需救援物资--需棉被
const evaluateResultLegendData6_3 = ref([
  {code:"0",name:"需棉被（床）",color:"red"},
]);
//评估结果图层图例范围6--需救援物资--需食品
const evaluateResultLegendData6_4 = ref([
  {code:"0",name:"需食品（吨）",color:"red"},
]);
//评估结果图层图例范围6--需救援物资--需饮水
const evaluateResultLegendData6_5 = ref([
  {code:"0",name:"需饮水（吨）",color:"red"},
]);
//评估结果图层图例范围6--需救援物资--需临时厕所
const evaluateResultLegendData6_6 = ref([
  {code:"0",name:"需临时厕所（个）",color:"red"},
]);
//评估结果图层图例范围6--需救援物资--需临时浴室
const evaluateResultLegendData6_7 = ref([
  {code:"0",name:"需临时浴室（个）",color:"red"},
]);
//评估结果图层图例范围7--需医疗物资
const evaluateResultLegendData7 = ref([
  {code:"0",name:"需病房（平方米）",color:"red"},
  {code:"1",name:"需病床（张）",color:"blue"},
  {code:"2",name:"需血浆（升）",color:"orange"},
]);
//评估结果图层图例范围8--人员死亡分布图（修正前）
const evaluateResultLegendData8 = ref([
  {code:"0",name:"0",color:"rgba(245,255,143,0.8)"},
  {code:"1",name:"0-1",color:"rgba(255,248,56,0.8)"},
  {code:"2",name:"1-5",color:"rgba(255,188,0,0.8)"},
  {code:"3",name:"5-10",color:"rgba(255,153,0,0.8)"},
  {code:"4",name:"10-20",color:"rgba(255,115,22,0.8)"},
  {code:"5",name:"20-50",color:"rgba(255,68,0,0.8)"},
  {code:"5",name:"50-100",color:"rgba(255,17,0,0.8)"},
  {code:"5",name:"100-500",color:"rgba(210,0,0,0.8)"},
  {code:"5",name:"500以上",color:"rgba(138,0,0,0.8)"},
]);
//评估结果图层图例范围8--经济损失亡分布图（修正前）
const evaluateResultLegendData9 = ref([
  {code:"0",name:"0-500",color:"rgba(240,119,6,0.2)"},
  {code:"1",name:"500-2000",color:"rgba(240,119,6,0.3)"},
  {code:"2",name:"2000-5000",color:"rgba(240,119,6,0.4)"},
  {code:"3",name:"5000-10000",color:"rgba(240,119,6,0.5)"},
  {code:"4",name:"10000-20000",color:"rgba(240,119,6,0.6)"},
  {code:"5",name:"20000以上",color:"rgba(240,119,6,0.7)"},
]);
//评估结果图层图例范围8--需紧急安置人数分布图（修正前）
const evaluateResultLegendData10 = ref([
  {code:"0",name:"0-100",color:"rgba(110,13,241,0.2)"},
  {code:"1",name:"100-500",color:"rgba(110,13,241,0.3)"},
  {code:"2",name:"500-1000",color:"rgba(110,13,241,0.4)"},
  {code:"3",name:"1000-2000",color:"rgba(110,13,241,0.5)"},
  {code:"4",name:"2000-3000",color:"rgba(110,13,241,0.6)"},
  {code:"5",name:"3000以上",color:"rgba(110,13,241,0.7)"},
]);

//地图传参--start
const completeRefreshInfluence = ref(false);//防止刷新后地图不显示
const mapLoading = (msg)=>{//地图查询loading
  if(msg!=null){
    proxy.$modal.loading(msg);
  }else{
    proxy.$modal.closeLoading();
  }
}
const returnSetPage = (bool)=>{//返回设定地震
  //router.push({path: "/earthquakeLossesEstimation/earthquakeDetail"});
  let id = taskUuid.value;
  let type = taskType.value;
  let taskPattern = pattern.value;
  let pageName = returnPageName.value;
  router.push({ path: "/earthquakeLossesEstimation/earthquakeDetail", query: {taskId: id, taskType:type, pattern:taskPattern, metaTitle: pageName} })
}
//地图对象
const map = ref(null);
const getMap = (obj)=>{
  map.value = obj;
}
const resetClearAllBool = ref(false);//是否清空全部超图图层
//选中的地图要素的属性
const getSelectFeatureProperties = (obj)=>{
  selectFeatureProperties.value = obj;
}
//click选中的经纬度
const getClickCoordinate = (lonlat)=>{
  clickCoordinate.value = lonlat;
}
//选中的地图要素的属性
const showBaseDataLayerControl = (bool)=>{
  showHideBaseDataLayerDivBool.value = bool;
}
//查看地震影响场
const showInfluenceEvent = (obj)=>{
  if(obj!=null){
    //显示地震影响场图层
    showInfluenceEllipseBool.value = true;
    //设置显示图层类型
    //showLayerType.value="地震影响场";//显示图层类型：基础数据图层|地震影响场|抗震能力分布图层|区县致死性差异性分布|评估结果
    //震中经纬度
    lonSelect.value = obj.lon;
    latSelect.value = obj.lat;
    numSelect.value = obj.num;//序号
    //根据任务ID、序号，查询震级、角度列表
    queryInfluencefliedLevelAngleListByIdNum();
  }else{
    //隐藏震级角度面板
    levelAngleDivBool.value = false;
    //隐藏地震影响场图层
    showInfluenceEllipseBool.value = false;
  }
}

//查询抗震能力分布图层
const showSeismicCapacityDistributionLayer = (bool)=>{
  //是否显示抗震能力分布图层
  showSeismicCapacityDistributionBool.value = bool;
  //清空数据
  seismicCapacityDistributionListData.value = [];
  if(bool){
    mapLoading("正在查询...");
    //设置显示图层类型
    //showLayerType.value="抗震能力分布图层";//显示图层类型：基础数据图层|地震影响场|抗震能力分布图层|区县致死性差异性分布|评估结果
    let taskId = queryParams.value.taskId;//任务主键ID
    let dzIntensity = intensitySelect.value;//烈度
    let type = capacityDistributionType.value;//抗震能力分布图层查询类型 0:区县级,1:乡镇级,2:公里格网级
    //查询抗震能力分布图层
    getSeiCapCalculation(taskId,dzIntensity,type).then((response) => {
      nextTick(() => {
        console.log("查询抗震能力分布图层"+taskId);
        console.log(response.data);
        if(response.data!=null){
          seismicCapacityDistributionListData.value = response.data;
        }
        /*if(type==="0" || type==="1"){
          //是否显示区县、乡镇抗震能力分布表
          showSeismicCapacityTable.value = true;
        }*/
        mapLoading(null);
      });
    });
  }
}
//查询区县致死性差异性分布图层
const showCountyDeathDiff = (bool)=>{
  //是否显示区县致死性差异性分布
  showCountyDeathDiffBool.value = bool;
  //清空数据
  countyDeathDiffListData.value = [];
  if(bool){
    //设置显示图层类型
    //showLayerType.value="区县致死性差异性分布";//显示图层类型：基础数据图层|地震影响场|抗震能力分布图层|区县致死性差异性分布|评估结果
    //根据任务id获取区县致死性差异性分布数据
    getLethalityDifferenceFinalValue(taskUuid.value).then((response) => {
      nextTick(() => {
        console.log("获取区县致死性差异性分布数据"+taskUuid.value);
        console.log(response.data);
        if(response.data!=null){
          countyDeathDiffListData.value = response.data;
        }
      });
    });
  }
}
//显示隐藏评估结果选择面板
const showEvaluateResultSelect = (bool)=>{
  showHideEvaluateResultLayerDivBool.value = bool;
  if(bool==false){
    //清空评估结果选择
    evaluateResultLayerSelectData.value = [];
    //清空评估结果查询内容等
    clearHideEvaluateDataDiv();
  }else{
    //设置显示图层类型
    //showLayerType.value="评估结果";//显示图层类型：基础数据图层|地震影响场|抗震能力分布图层|区县致死性差异性分布|评估结果
  }
}
//查看评估结果
const showEvaluateResultEvent = (obj)=>{
  if(obj!=null){
    //震中经纬度
    lonSelect.value = obj.lon;
    latSelect.value = obj.lat;
    numSelect.value = obj.num;//序号
    //根据评估结果类型查询数据
    let selectType = evaluateResultLayerSelectType.value;
    if(selectType=="人员死亡分布图（修正前）" || selectType=="经济损失分布图（修正前）" || selectType=="需紧急安置人数分布图（修正前）"){
      //评估结果烈度选择事件
      radioEvaluateDistributionIntensitySelect();
    }else{
      //评估结果--根据任务ID、序号，查询震级、角度列表
      queryEvaluateResultLevelAngleListByIdNum();
    }
  }else{
    //隐藏评估结果--震级角度面板
    levelAngleEvaluateResultDivBool.value = false;
    //隐藏评估结果--角度选择
    angleEvaluateResultBool.value = false;
    //清空评估结果选择
    evaluateResultLayerSelectType.value = "";
  }
}
//地图传参--end

//点击切换单选按钮事件
function radioSelect(){
  mapLoading("正在查询...");
  let level = levelSelect.value;//震级
  let angle = angleSelect.value;//角度
  if(level!="" && angle!=""){
    //查询地震影响场
    queryInfluenceEllipse();
  }
}

//查询全部评估结果（未选择角度：最小值,最大值）
function queryAllEvaluateResultTotalDetailsMinMax(taskId,level,type,lengthStr){
  //根据taskId、震级、查询类型、序号总个数，按序号从小到大排序查询全部评估结果（未选择角度：最小值,最大值）
  queryAllEvaluateResultTotalDetails({taskId:taskId,level:level,type:type,lengthStr:lengthStr}).then((response) => {
    nextTick(() => {
      console.log("查询全部评估结果（未选择角度：最小值,最大值）");
      console.log(response.data);
      //查询评估结果列表
      evaluateResultListData.value = response.data;
    });
  });
}

//查询1条评估结果（选择角度）
function getEvaluateResultTotalDetailsByAngle(type,taskId,level,angle,num,longitude,latitude){
  //根据查询类型、taskId、震级、角度、序号、经度、纬度，查询评估结果（选择角度：1条数据）
  queryEvaluateResultTotalDetailsByAngle({type:type,taskId:taskId,level:level,angle:angle,num:num,longitude:longitude,latitude:latitude}).then((response) => {
    nextTick(() => {
      console.log("查询1条评估结果（选择角度）");
      console.log(response.data);
      //查询评估结果列表
      evaluateResultListData.value = response.data;
    });
  });
}

//评估结果--震级、角度面板点击切换单选按钮事件
function radioEvaluateResultSelect(){
  let taskId = queryParams.value.taskId;//任务主键ID
  let num = numSelect.value;//序号
  let level = levelSelect.value;//震级
  let angle = angleSelect.value;//角度
  //根据评估结果类型查询数据
  let selectType = evaluateResultLayerSelectType.value;
  let list = allSettingData.value;//全部设定地震数据
  if(num===""){//查询全部设定地震的评估结果
    if(list!=null && list.length>0){
      let lengthStr = list.length;
      //查询全部评估结果（未选择角度：最小值,最大值）
      queryAllEvaluateResultTotalDetailsMinMax(taskId,level,selectType,lengthStr);
    }
  }else{//查询序号为num的设定地震
    //震中经纬度
    let longitude = lonSelect.value;
    let latitude = latSelect.value;
    //查询1条评估结果（选择角度）
    getEvaluateResultTotalDetailsByAngle(selectType,taskId,level,angle,num,longitude,latitude);
  }
}

//评估结果--勾选图层事件
function chooseEvaluateResultLayers(){
  console.log("勾选图层事件");
  console.log(evaluateResultLayerSelectData.value);
  //清空评估结果查询内容等
  clearHideEvaluateDataDiv();
  let array = evaluateResultLayerSelectData.value;
  if(array!=null && array.length>0){
    let selectType = array[0];
    if(array.length==2){
      selectType = array[1];
    }
    evaluateResultLayerSelectType.value = selectType;
    //根据评估结果类型查询数据
    if(selectType=="震后交通情况分布图"){
      //震后交通情况分布图评估结果烈度选择事件
      radioEvaluateDzIntensitySelect();
    }else if(selectType=="人员死亡分布图（修正前）" || selectType=="经济损失分布图（修正前）" || selectType=="需紧急安置人数分布图（修正前）"){
      //设置图例
      if(selectType=="人员死亡分布图（修正前）"){
        //评估结果图例名称
        evaluateResultLegendTitle.value = "死亡人数";
        evaluateResultLegendData.value = evaluateResultLegendData8.value;
      }else if(selectType=="经济损失分布图（修正前）"){
        //评估结果图例名称
        evaluateResultLegendTitle.value = "经济损失（万元）";
        evaluateResultLegendData.value = evaluateResultLegendData9.value;
      }else if(selectType=="需紧急安置人数分布图（修正前）"){
        //评估结果图例名称
        evaluateResultLegendTitle.value = "需安置人数";
        evaluateResultLegendData.value = evaluateResultLegendData10.value;
      }
      showEvaluateResultBool.value = true;//显示图例
      //评估结果烈度选择事件
      radioEvaluateDistributionIntensitySelect();
    }else{
      //评估结果图例名称
      evaluateResultLegendTitle.value = selectType;
      //设置图例
      if(selectType=="人员伤亡"){
        evaluateResultLegendData.value = evaluateResultLegendData1.value;
      }else if(selectType=="经济损失"){
        evaluateResultLegendData.value = evaluateResultLegendData2.value;
      }else if(selectType=="需紧急安置人数"){
        evaluateResultLegendData.value = evaluateResultLegendData3.value;
      }else if(selectType=="需救援队伍"){
        evaluateResultLegendData.value = evaluateResultLegendData4.value;
      }else if(selectType=="需医务人员"){
        evaluateResultLegendData.value = evaluateResultLegendData5.value;
      }else if(array[0]=="需救援物资"){//需救援物资
        if(selectType=="需帐篷数"){//需救援物资
          evaluateResultLegendData.value = evaluateResultLegendData6_1.value;
        }else if(selectType=="需担架"){//需救援物资
          evaluateResultLegendData.value = evaluateResultLegendData6_2.value;
        }else if(selectType=="需棉被"){//需救援物资
          evaluateResultLegendData.value = evaluateResultLegendData6_3.value;
        }else if(selectType=="需食品"){//需救援物资
          evaluateResultLegendData.value = evaluateResultLegendData6_4.value;
        }else if(selectType=="需饮水"){//需救援物资
          evaluateResultLegendData.value = evaluateResultLegendData6_5.value;
        }else if(selectType=="需临时厕所"){//需救援物资
          evaluateResultLegendData.value = evaluateResultLegendData6_6.value;
        }else if(selectType=="需临时浴室"){//需救援物资
          evaluateResultLegendData.value = evaluateResultLegendData6_7.value;
        }
      }else if(selectType=="需医疗物资"){
        evaluateResultLegendData.value = evaluateResultLegendData7.value;
      }
      showEvaluateResultBool.value = true;//显示图例
      //评估结果--根据taskId，查询全部设定地震的震级列表
      queryAllInfluencefliedLevelListByTaskId();
    }
  }
}

//清空评估结果查询内容等
function clearHideEvaluateDataDiv(){
  //清空评估结果数据
  evaluateResultListData.value = [];
  //清空震后交通清空分布图数据
  countyLandslideListData.value = [];
  countyLandslideBufferList.value = [];
  //清空评估结果选择
  evaluateResultLayerSelectType.value = "";
  //隐藏评估结果震级角度选择面板
  levelAngleEvaluateResultDivBool.value = false;
  //隐藏评估结果--角度选择
  angleEvaluateResultBool.value = false;
  //隐藏评估结果图例
  showEvaluateResultBool.value = false;
  //隐藏震后交通情况分布图图例
  showCountyLandslideBool.value = false;
}

//警告消息
function alertMsg(msg){
  proxy.$modal.msgWarning(msg);
}

//初始化查询全部评估结果列表
function initQueryAllSetting(){
  queryParams.value.type = "";
  allSettingData.value = [];//清空
  let taskId = queryParams.value.taskId;//任务主键ID
  //查询全部评估结果
  getResultTotalByTaskId({taskId:taskId}).then((response) => {
    nextTick(() => {
      console.log("查询全部评估结果列表");
      console.log(response.data);
      //全部设定地震图层数据
      allSettingData.value = response.data;
      //判断页签内容
      let metaTitleName = metaTitle.value;
      console.log("metaTitle:"+metaTitleName);
      if(metaTitleName=="查看地震影响场"){
        showLayerType.value="地震影响场";//显示图层类型：基础数据图层|地震影响场|抗震能力分布图层|区县致死性差异性分布|评估结果
      }else if(metaTitleName=="查看建筑物抗震能力分布"){
        showLayerType.value="抗震能力分布图层";//显示图层类型：基础数据图层|地震影响场|抗震能力分布图层|区县致死性差异性分布|评估结果
      }else if(metaTitleName=="查看区县致死性差异性分布"){
        showLayerType.value="区县致死性差异性分布";//显示图层类型：基础数据图层|地震影响场|抗震能力分布图层|区县致死性差异性分布|评估结果
      }else if(metaTitleName=="评估结果-人员伤亡"){
        showLayerType.value="评估结果";//显示图层类型：基础数据图层|地震影响场|抗震能力分布图层|区县致死性差异性分布|评估结果
        evaluateResultLayerSelectData.value = ["人员伤亡"];
        //评估结果--勾选图层事件
        chooseEvaluateResultLayers();
      }else if(metaTitleName=="评估结果-经济损失"){
        showLayerType.value="评估结果";//显示图层类型：基础数据图层|地震影响场|抗震能力分布图层|区县致死性差异性分布|评估结果
        evaluateResultLayerSelectData.value = ["经济损失"];
        //评估结果--勾选图层事件
        chooseEvaluateResultLayers();
      }else if(metaTitleName=="评估结果-需紧急安置人数"){
        showLayerType.value="评估结果";//显示图层类型：基础数据图层|地震影响场|抗震能力分布图层|区县致死性差异性分布|评估结果
        evaluateResultLayerSelectData.value = ["需紧急安置人数"];
        //评估结果--勾选图层事件
        chooseEvaluateResultLayers();
      }else if(metaTitleName=="评估结果-需救援力量"){
        showLayerType.value="评估结果";//显示图层类型：基础数据图层|地震影响场|抗震能力分布图层|区县致死性差异性分布|评估结果
        evaluateResultLayerSelectData.value = ["需救援队伍"];
        //评估结果--勾选图层事件
        chooseEvaluateResultLayers();
      }else if(metaTitleName=="评估结果-需救援物资"){
        showLayerType.value="评估结果";//显示图层类型：基础数据图层|地震影响场|抗震能力分布图层|区县致死性差异性分布|评估结果
        evaluateResultLayerSelectData.value = ["需救援物资","需帐篷数"];
        //评估结果--勾选图层事件
        chooseEvaluateResultLayers();
      }else if(metaTitleName=="评估结果-震后交通情况分布图"){
        showLayerType.value="评估结果";//显示图层类型：基础数据图层|地震影响场|抗震能力分布图层|区县致死性差异性分布|评估结果
        evaluateResultLayerSelectData.value = ["震后交通情况分布图"];
        //评估结果--勾选图层事件
        chooseEvaluateResultLayers();
      }
      //显示地图
      // completeRefreshInfluence.value = true;
      mapLoading(null);
    });
  });
}

//处理经纬度
function getLonLat(longitude,latitude){
  let lonlat = null;
  if(longitude!=null && latitude!=null && longitude!="" && latitude!=""){
    let lon = Number(longitude);
    let lat = Number(latitude);
    if(lon>0 && lon<180 && lat>0 && lat<90){
      lonlat = [lon,lat];
    }
  }

  return lonlat;
}

//获取任务信息
function getTaskInfo(){
  taskUuid.value = route.query.id;
  taskType.value = route.query.taskType;
  pattern.value = route.query.pattern;
  metaTitle.value = route.query.metaTitle;
  returnPageName.value = route.query.name;
  let id = taskUuid.value;
  if(id!=null && id!=undefined){
    queryParams.value.taskId = id;//任务主键ID
    settingSeismic.value.taskId = id;//任务主键ID
    //显示地图
    completeRefreshInfluence.value = true;
    mapLoading("正在查询...");
    //查询任务信息
    getTaskInfoById(id).then((response) => {
      nextTick(() => {
        console.log("查询任务"+id);
        //console.log(response.data);
        //任务区域经纬度
        taskRegion.value = response.data.taskRegion;
        //任务地区
        taskDistrict.value = response.data.taskDistrict;
        //获取任务区域经纬度数组
        getTaskRegionCoordinateArray();
        //初始化查询全部评估结果
        initQueryAllSetting();
        /*setTimeout(function(){
          initQueryAllSetting();
        },2000);*/
      });
    });
  }
}

//获取任务区域经纬度数组
function getTaskRegionCoordinateArray(){
  let regionStr = taskRegion.value;
  //任务区域经纬度数组
  taskRegionCoordinateArray.value = [];
  if(regionStr.indexOf("MULTIPOLYGON")==-1) {//地图绘制区域
    console.log("地图绘制区域");
    let coordinates = [];
    let arr = regionStr.split(";");
    if(arr!=null && arr.length>0){
      for(let j=0;j<arr.length;j++){
        let lonlatStr = arr[j].split(",");
        let lonlat = [];
        lonlat.push(Number(lonlatStr[0]));
        lonlat.push(Number(lonlatStr[1]));
        coordinates.push(lonlat);
      }
    }
    let allPointsArr = [coordinates];
    //任务区域经纬度数组
    taskRegionCoordinateArray.value.push(allPointsArr);
  }else{//行政区划选择区域
    console.log("行政区划选择区域");
    let allCoordinates = [];
    let all_coords_str = regionStr.split(";");
    for(let i=0;i<all_coords_str.length;i++){
      let coords_str = all_coords_str[i].split("MULTIPOLYGON (((")[1].split(")))")[0];
      if(coords_str.indexOf(")), ((")!=-1){
        //console.log("多个的面");
      }
      let geometries = coords_str.split(")), ((");
      for (let k = 0;k < geometries.length;k++) {
        let allPointsArr = [];
        if(coords_str.indexOf("), (")!=-1){
          //console.log("镂空的面");
        }
        let __coords = geometries[k].split("), (");
        for (let m = 0;m < __coords.length;m++) {
          let _coords = __coords[m].split(", "), points = [];
          for (let n = 0;n < _coords.length;n++) {
            if(_coords[n]!=null && _coords[n]!=""){
              let coord = _coords[n].split(" ");
              let lon = Number(coord[0]), lat = Number(coord[1]);
              let lonlat = [lon, lat];
              points.push(lonlat);
              allCoordinates.push(lonlat);
            }
          }
          allPointsArr.push(points);
          //不对空洞的面进行相交处理
          break;
        }
        //任务区域经纬度数组
        taskRegionCoordinateArray.value.push(allPointsArr);
      }
    }
  }
}

//根据任务ID查询任务区域行政区划code列表
function getAllCodeList(){
  let id = taskUuid.value;
  //查询任务信息
  getAllCodeListByTaskId(id).then((response) => {
    nextTick(() => {
      console.log("查询任务区域行政区划code列表结果"+id);
      console.log(response.data);
    });
  });
}


//根据参数创建地震影响场
function createInfluenceEllipseByParams(index,lon,lat,long_x,short_y,angle,min_long_x,min_short_y){
  //lonlat = "116 39";
  if(lon!=null && lat!=null && long_x!=null && short_y!=null &&
      lon!="" && lat!="" && long_x!="" && short_y!=""){
    createInfluenceEllipse({lon:lon,lat:lat,long_x:long_x,short_y:short_y,angle:angle,min_long_x:min_long_x,min_short_y:min_short_y}).then((response) => {
      nextTick(() => {
        console.log("根据参数创建地震影响场查询结果");
        console.log(response.data);
        influenceEllipseList.value = [null,long_x,short_y,response.data];
      });
    });
  }
}

//根据任务ID、序号，查询震级、角度列表
function queryInfluencefliedLevelAngleListByIdNum(){
  mapLoading("正在查询...");
  let taskId = queryParams.value.taskId;//任务主键ID
  let num = numSelect.value;//序号
  //隐藏震级角度面板
  levelAngleDivBool.value = false;
  //清空
  levelData.value = [];//震级列表
  angleData.value = [];//角度列表
  levelSelect.value = "";
  angleSelect.value = "";

  //根据任务ID、序号，查询震级、角度列表
  queryInfluencefliedLevelAngleList({taskId:taskId,num:num}).then((response) => {
    nextTick(() => {
      console.log("根据任务ID、序号，查询震级、角度列表");
      console.log(response.data);
      let resultList = response.data;
      if(resultList!=null && resultList.length>0){
        //
      }else{
        //警告消息
        alertMsg("无查询结果！");
      }
      levelData.value = resultList[0];//震级列表
      angleData.value = resultList[1];//角度列表
      //设置震级默认值
      if(resultList[0].length>0){
        levelSelect.value = resultList[0][0];//震级
      }
      //设置角度默认值
      if(resultList[1].length>0){
        angleSelect.value = resultList[1][0];//角度
      }
      //显示震级角度面板
      //levelAngleDivBool.value = true;
      //查询地震影响场
      queryInfluenceEllipse();
    });
  });
}

//评估结果--根据任务ID、序号，查询震级、角度列表
function queryEvaluateResultLevelAngleListByIdNum(){
  mapLoading("正在查询...");
  let taskId = queryParams.value.taskId;//任务主键ID
  let num = numSelect.value;//序号
  //隐藏评估结果--震级角度面板
  levelAngleEvaluateResultDivBool.value = false;
  //隐藏评估结果--角度选择
  angleEvaluateResultBool.value = false;
  //清空
  levelData.value = [];//震级列表
  angleData.value = [];//角度列表
  levelSelect.value = "";
  angleSelect.value = "";
  //根据任务ID、序号，查询震级、角度列表
  queryInfluencefliedLevelAngleList({taskId:taskId,num:num}).then((response) => {
    nextTick(() => {
      console.log("评估结果--根据任务ID、序号，查询震级、角度列表");
      console.log(response.data);
      let resultList = response.data;
      levelData.value = resultList[0];//震级列表
      angleData.value = resultList[1];//角度列表
      //设置震级默认值
      if(resultList[0].length>0){
        levelSelect.value = resultList[0][0];//震级
      }
      //设置角度默认值
      if(resultList[1].length>0){
        angleSelect.value = resultList[1][0];//角度
      }
      //显示评估结果--震级角度面板
      levelAngleEvaluateResultDivBool.value = true;
      //显示评估结果--角度选择
      angleEvaluateResultBool.value = true;
      //评估结果--点击切换单选按钮事件
      radioEvaluateResultSelect();
      mapLoading(null);
    });
  });
}

//评估结果--根据taskId，查询全部设定地震的震级列表
function queryAllInfluencefliedLevelListByTaskId(){
  mapLoading("正在查询...");
  numSelect.value = "";//清空序号
  let taskId = queryParams.value.taskId;//任务主键ID
  //隐藏评估结果--震级角度面板
  levelAngleEvaluateResultDivBool.value = false;
  //隐藏评估结果--角度选择
  angleEvaluateResultBool.value = false;
  //清空
  levelData.value = [];//震级列表
  angleData.value = [];//角度列表
  levelSelect.value = "";
  angleSelect.value = "";
  //根据taskId，查询全部设定地震的震级列表
  queryInfluencefliedLevelListByTaskId({taskId:taskId}).then((response) => {
    nextTick(() => {
      console.log("评估结果--根据taskId，查询全部设定地震的震级列表");
      console.log(response.data);
      let resultList = response.data;
      levelData.value = resultList;//震级列表
      //设置震级默认值
      if(resultList!=null && resultList.length>0){
        levelSelect.value = resultList[0];//震级
        //显示评估结果--震级角度面板
        levelAngleEvaluateResultDivBool.value = true;
        //隐藏评估结果--角度选择
        //angleEvaluateResultBool.value = false;
        //评估结果--点击切换单选按钮事件
        radioEvaluateResultSelect();
      }else{
        //警告消息
        alertMsg("无查询结果！");
      }
      mapLoading(null);
    });
  });
}

//查询地震影响场
function queryInfluenceEllipse(){
  let taskId = queryParams.value.taskId;//任务主键ID
  let level = levelSelect.value;//震级
  let angle = angleSelect.value;//角度
  let num = numSelect.value;//序号
  //震中经纬度
  let longitude = lonSelect.value;
  let latitude = latSelect.value;
  influenceEllipseList.value = [];//清空
  //根据taskId、震级、角度、序号、经度、纬度，按烈度从小到大排序查询地震影响场
  queryInfluencefliedEllipse({taskId:taskId,level:level,angle:angle,num:num,longitude:longitude,latitude:latitude}).then((response) => {
    nextTick(() => {
      console.log("根据参数查询地震影响场查询结果");
      console.log(response.data);
      let resultList = response.data;
      influenceEllipseList.value = response.data;
      if(resultList!=null && resultList.length>0){
        //if(resultList[0][1]!=null){
          //显示震级角度面板
          levelAngleDivBool.value = true;
        //}
      }else{
        //警告消息
        alertMsg("无查询结果！");
      }
      mapLoading(null);
    });
  });
}

//抗震能力分布烈度选择事件
function radioIntensitySelect(){
  if(showSeismicCapacityDistributionBool.value){
    //查询抗震能力分布图层
    showSeismicCapacityDistributionLayer(true);
  }
}

//评估结果烈度选择事件
function radioEvaluateDistributionIntensitySelect(){
  console.log("评估结果烈度选择事件");
  console.log(evaluateResultLegendData.value);
  countPbeBool.value = false;//隐藏统计表格
  //根据评估结果类型查询数据
  let selectType = evaluateResultLayerSelectType.value;
  if(selectType=="人员死亡分布图（修正前）"){
    //显示人员死亡分布图（修正前）
    showEvalateDeathDistribution();
  }else if(selectType=="经济损失分布图（修正前）"){
    //显示经济损失分布图（修正前）
    showEvalateEconomyDistribution();
  }else if(selectType=="需紧急安置人数分布图（修正前）"){
    //显示需紧急安置人数分布图（修正前）
    showEmergencyDistribution();
  }
}

//显示人员死亡分布图（修正前）
function showEvalateDeathDistribution(){
  //清空数据
  evaluateResultListData.value = [];
  mapLoading("正在查询...");
  //设置显示图层类型
  //showLayerType.value="评估结果";//显示图层类型：基础数据图层|地震影响场|抗震能力分布图层|区县致死性差异性分布|评估结果
  let taskId = queryParams.value.taskId;//任务主键ID
  let dzIntensity = intensitySelect.value;//烈度
  //查询人员死亡分布图（修正前）
  getPbeInjuriesByTaskIdAndIntensity(taskId,dzIntensity).then((response) => {
    nextTick(() => {
      console.log("查询人员死亡分布图（修正前）"+taskId);
      console.log(response.data);
      if(response.data!=null){
        evaluateResultListData.value = response.data;
      }
      mapLoading(null);
    });
  });
}

//显示经济损失分布图（修正前）
function showEvalateEconomyDistribution(){
  //清空数据
  evaluateResultListData.value = [];
  mapLoading("正在查询...");
  //设置显示图层类型
  //showLayerType.value="评估结果";//显示图层类型：基础数据图层|地震影响场|抗震能力分布图层|区县致死性差异性分布|评估结果
  let taskId = queryParams.value.taskId;//任务主键ID
  let dzIntensity = intensitySelect.value;//烈度
  //查询经济损失分布图（修正前）
  getPbeLossesByTaskIdAndIntensity(taskId,dzIntensity).then((response) => {
    nextTick(() => {
      console.log("查询经济损失分布图（修正前）"+taskId);
      console.log(response.data);
      if(response.data!=null){
        evaluateResultListData.value = response.data;
      }
      mapLoading(null);
    });
  });
}

//显示需紧急安置人数分布图（修正前）
function showEmergencyDistribution(){
  //清空数据
  evaluateResultListData.value = [];
  mapLoading("正在查询...");
  //设置显示图层类型
  //showLayerType.value="评估结果";//显示图层类型：基础数据图层|地震影响场|抗震能力分布图层|区县致死性差异性分布|评估结果
  let taskId = queryParams.value.taskId;//任务主键ID
  let dzIntensity = intensitySelect.value;//烈度
  //查询需紧急安置人数分布图（修正前）
  getPbeByTaskIdAndIntensity(taskId,dzIntensity).then((response) => {
    nextTick(() => {
      console.log("查询需紧急安置人数分布图（修正前）"+taskId);
      console.log(response.data);
      if(response.data!=null){
        evaluateResultListData.value = response.data;
      }
      mapLoading(null);
    });
  });
}

//按区县、乡镇统计事件
function countPbeEvent(qcType){
  console.log("按区县、乡镇统计事件");
  //qcType:0区县 1乡镇
  countPbeType.value = qcType;//统计类型：0区县 1乡镇
  //清空数据
  countPbeListData.value = [];//评估结果按区县、乡镇统计表数据
  //根据评估结果类型查询数据
  let selectType = evaluateResultLayerSelectType.value;
  if(selectType=="人员死亡分布图（修正前）"){
    //显示人员死亡按区县、乡镇统计表
    showCountPbeInjuries(qcType);
  }else if(selectType=="经济损失分布图（修正前）"){
    //显示经济损失按区县、乡镇统计表
    showCountPbeLosses(qcType);
  }else if(selectType=="需紧急安置人数分布图（修正前）"){
    //显示需紧急安置人数按区县、乡镇统计表
    showCountPbePlant(qcType);
  }
}

//显示人员死亡按区县、乡镇统计表
function showCountPbeInjuries(qcType){
  mapLoading("正在查询...");
  //设置显示图层类型
  let taskId = queryParams.value.taskId;//任务主键ID
  let dzIntensity = intensitySelect.value;//烈度
  //查询人员死亡按区县、乡镇统计表
  countPbeInjuries(taskId,dzIntensity,qcType).then((response) => {
    nextTick(() => {
      console.log("查询人员死亡按区县、乡镇统计表");
      console.log(response.data);
      let result = response.data;
      if(result && result.length==2){
        let nameList = result[0];
        let sumList = result[1];
        let list = [];
        for(let i=0;i<nameList.length;i++){
          let name = nameList[i];
          let sum = sumList[i];
          let obj = Object.create(null);
          if(qcType==="0"){
            obj["county"] = name;
          }else if(qcType==="1"){
            obj["town"] = name;
          }
          obj["sumInjuries"] = sum;//死亡人数
          list.push(obj);
        }
        countPbeListData.value = list;//评估结果按区县、乡镇统计表数据
      }
      countPbeBool.value = true;//显示统计表格
      mapLoading(null);
    });
  });
}

//显示经济损失按区县、乡镇统计表
function showCountPbeLosses(qcType){
  mapLoading("正在查询...");
  //设置显示图层类型
  let taskId = queryParams.value.taskId;//任务主键ID
  let dzIntensity = intensitySelect.value;//烈度
  //查询经济损失按区县、乡镇统计表
  countPbeLosses(taskId,dzIntensity,qcType).then((response) => {
    nextTick(() => {
      console.log("查询经济损失按区县、乡镇统计表");
      console.log(response.data);
      let result = response.data;
      if(result && result.length==2){
        let nameList = result[0];
        let sumList = result[1];
        let list = [];
        for(let i=0;i<nameList.length;i++){
          let name = nameList[i];
          let sum = sumList[i];
          let obj = Object.create(null);
          if(qcType==="0"){
            obj["county"] = name;
          }else if(qcType==="1"){
            obj["town"] = name;
          }
          obj["sumLosses"] = sum;//经济损失（万元）
          list.push(obj);
        }
        countPbeListData.value = list;//评估结果按区县、乡镇统计表数据
      }
      countPbeBool.value = true;//显示统计表格
      mapLoading(null);
    });
  });
}

//显示需紧急安置人数按区县、乡镇统计表
function showCountPbePlant(qcType){
  mapLoading("正在查询...");
  //设置显示图层类型
  let taskId = queryParams.value.taskId;//任务主键ID
  let dzIntensity = intensitySelect.value;//烈度
  //查询需紧急安置人数按区县、乡镇统计表
  countPbePlant(taskId,dzIntensity,qcType).then((response) => {
    nextTick(() => {
      console.log("查询需紧急安置人数按区县、乡镇统计表");
      console.log(response.data);
      let result = response.data;
      if(result && result.length==2){
        let nameList = result[0];
        let sumList = result[1];
        let list = [];
        for(let i=0;i<nameList.length;i++){
          let name = nameList[i];
          let sum = sumList[i];
          let obj = Object.create(null);
          if(qcType==="0"){
            obj["county"] = name;
          }else if(qcType==="1"){
            obj["town"] = name;
          }
          obj["sumPlant"] = sum;//需紧急安置人数
          list.push(obj);
        }
        countPbeListData.value = list;//评估结果按区县、乡镇统计表数据
      }
      countPbeBool.value = true;//显示统计表格
      mapLoading(null);
    });
  });
}

//评估结果--根据taskId，查询缓冲区内相交部分的道路数据、滑坡计算结果网格（震后交通情况分布图）
function getAllYpgResultSlopeRoadByTaskId(dzIntensity){
  mapLoading("正在查询...");
  numSelect.value = "";//清空序号
  let taskId = queryParams.value.taskId;//任务主键ID
  //隐藏评估结果--震级角度面板
  levelAngleEvaluateResultDivBool.value = false;
  //隐藏评估结果--角度选择
  angleEvaluateResultBool.value = false;
  //隐藏评估结果图例
  showEvaluateResultBool.value = false;
  //清空
  levelData.value = [];//震级列表
  angleData.value = [];//角度列表
  levelSelect.value = "";
  angleSelect.value = "";
  //是否显示震后交通情况分布图
  showCountyLandslideBool.value = true;
  //清空
  countyLandslideListData.value = [];
  showCountyLandslideSlopeBufferBool.value = false;
  //根据任务ID查询缓冲区内相交部分的道路数据、滑坡计算结果网格
  getYpgResultSlopeRoadByTaskId(taskId,dzIntensity).then((response) => {
    nextTick(() => {
      console.log("评估结果--根据任务ID查询缓冲区内相交部分的道路数据、滑坡计算结果网格");
      console.log(response.data);
      let resultList = response.data;
      if(resultList!=null && resultList.length==2){
        countyLandslideListData.value = response.data;
        let list = resultList[1];
        if(list!=null && list.length>0) {
          let resultSource = list[0].resultSource;//1:逻辑斯蒂滑坡模型,2:黄土高原模型
          if(resultSource=="1"){
            //震后交通情况分布图--计算滑坡等级的模型类型
            countLandslideType.value = "逻辑斯蒂模型计算滑坡等级";
          }else if(resultSource=="2"){
            //震后交通情况分布图--计算滑坡等级的模型类型
            countLandslideType.value = "黄土高原模型计算滑坡等级";
          }
        }
      }else{
        //警告消息
        alertMsg("无查询结果！");
      }
      mapLoading(null);
    });
  });
  //test
  /*layerDataTypeList.value[0] = {
    //震后交通情况分布图
    level2DataType:"eqTrafficCount",//数据类别二级code
    level3DataType:"eqTrafficSlope",//数据类别三级code
    versionCode:"全部",//查询临时图层过滤条件
    show:true,//是否显示
    isYw:true,//是否为业务系统数据，true业务系统，false基础数据系统
    tifFileName:"ypg逻辑斯蒂模型_最终计算_1691732602966_6",//tif文件名称
  };*/
}

const showCountyLandslideSlopeBufferBool = ref(false);//是否显示滑坡缓冲区图层
//根据任务ID查询滑坡缓冲区图层
function showCountyLandslideSlopeBuffer(){
  showCountyLandslideSlopeBufferBool.value = true;
  let resultList = [];
  //获取计算结果图层信息列表
  let allList = countyLandslideListData.value;
  if(allList!=null && allList.length==2){
    let list = allList[1];
    if(list!=null && list.length>0) {
      for (let i = 0; i < list.length; i++) {
        let layerType = list[i].extends1;//图层数据类型：最终计算、分级矢量化、缓冲区4级、缓冲区5级
        if (layerType == "缓冲区4级" || layerType == "缓冲区5级") {
          resultList.push(list[i]);
        }
      }
    }
  }
  countyLandslideBufferList.value = resultList;
  if(resultList.length==0){
    proxy.$modal.msgWarning("此烈度无缓冲区图层！");
    showCountyLandslideSlopeBufferBool.value = false;
  }
}

//隐藏滑坡缓冲区图层
function hideCountyLandslideSlopeBuffer(){
  showCountyLandslideSlopeBufferBool.value = false;
  //清空
  countyLandslideBufferList.value = [];
}

//显示震后遭遇交通情况影响统计表
function showCountyLandslideRoadTable(){
  showCountyLandslideRoadTableBool.value = true;
  mapLoading("正在查询...");
  let taskId = queryParams.value.taskId;//任务主键ID
  let dzIntensity = dzIntensitySelect.value;
  //根据任务ID查询缓冲区内相交部分的道路数据统计结果
  getYpgResultRoadListByTaskId(taskId,dzIntensity).then((response) => {
    nextTick(() => {
      console.log("评估结果--根据任务ID查询缓冲区内相交部分的道路数据统计结果");
      console.log(response.data);
      let resultList = response.data;
      if(resultList!=null && resultList.length>0){
        countyLandslideRoadList.value = response.data;
      }else{
        countyLandslideRoadList.value = [];
        //警告消息
        alertMsg("无查询结果！");
      }
      mapLoading(null);
    });
  });
}

//关闭震后遭遇交通情况影响统计表
function hideCountyLandslideRoadTable(){
  showCountyLandslideRoadTableBool.value = false;
}

//初始化设置填写交通情况面板数据
function resetCountyLandslideTrafficAnalysisData(){
  countyLandslideTrafficAnalysisData.value.uuid = "";//主键id
  countyLandslideTrafficAnalysisData.value.trafficAnalysis = "";//震后交通情况分析
  countyLandslideTrafficAnalysisData.value.taskId = queryParams.value.taskId;//任务主键ID
  countyLandslideTrafficAnalysisData.value.createUserId = "";//创建人Id
  countyLandslideTrafficAnalysisData.value.createUser = "";//创建人名称
  countyLandslideTrafficAnalysisData.value.createTime = "";//创建时间
  countyLandslideTrafficAnalysisData.value.updateUser = "";//修改人id
  countyLandslideTrafficAnalysisData.value.updateTime = "";//修改时间
  countyLandslideTrafficAnalysisData.value.isDelete = "";//删除标识：0未删除，1已删除
  countyLandslideTrafficAnalysisData.value.dzIntensity = "";//地震烈度（6-11度）
}

//显示填写交通情况面板
function showCountyLandslideRoadInfoDiv(){
  //初始化设置填写交通情况面板数据
  resetCountyLandslideTrafficAnalysisData();
  showCountyLandslideRoadInfoDivBool.value = true;
  let taskId = queryParams.value.taskId;//任务主键ID
  let dzIntensity = dzIntensitySelect.value;
  //查询填写交通情况
  getTrafficAnalysisByTaskId(taskId,dzIntensity).then((response) => {
    nextTick(() => {
      console.log("查询填写交通情况");
      console.log(response.data);
      let result = response.data;
      if(result!=null && result.uuid!=null && result.uuid!=""){
        countyLandslideTrafficAnalysisData.value = response.data;
      }
      console.log(countyLandslideTrafficAnalysisData.value);
    });
  });
}

//关闭填写交通情况面板
function hideCountyLandslideRoadInfoDiv(){
  showCountyLandslideRoadInfoDivBool.value = false;
}

//保存|更新震后交通情况分析
function saveUpdateTrafficAnalysisData(){
  //校验
  proxy.$refs["rulesForm"].validate((vaild) => {
    if(countyLandslideTrafficAnalysisData.value.trafficAnalysis==""){
      alertMsg("请填写震后交通情况分析！");
      return;
    }
    proxy.$modal.confirm('是否确认保存?').then(function () {
      if(countyLandslideTrafficAnalysisData.value.uuid==null || countyLandslideTrafficAnalysisData.value.uuid===""){//保存
        //地震烈度
        countyLandslideTrafficAnalysisData.value.dzIntensity = dzIntensitySelect.value;
        saveTrafficAnalysis(countyLandslideTrafficAnalysisData.value).then((response) => {
          nextTick(() => {
            let msg = response.data;
            console.log(msg);
            proxy.$modal.msgSuccess('保存成功！');
            //关闭填写交通情况面板
            hideCountyLandslideRoadInfoDiv();
          });
        });
      }else{//更新
        updateTrafficAnalysis(countyLandslideTrafficAnalysisData.value).then((response) => {
          nextTick(() => {
            let msg = response.data;
            console.log(msg);
            proxy.$modal.msgSuccess('保存成功！');
            //关闭填写交通情况面板
            hideCountyLandslideRoadInfoDiv();
          });
        });
      }
    }).catch(() => {});
  });
}

const roadRange = ref("");//道路影响范围m
//震后交通情况分布图评估结果烈度选择事件
function radioEvaluateDzIntensitySelect(){
  //设置全部无值
  for(let i=0;i<dzIntensityLegendData.value.length;i++){
    dzIntensityLegendData.value[i].noDataBool = true;
    dzIntensityLegendData.value[i].show = true;
  }
  roadRange.value = "";
  let taskId = queryParams.value.taskId;//任务主键ID
  getYpgResultSlopeNewIntensityList(taskId).then((response) => {
    nextTick(() => {
      let list = response.data ? response.data : [];
      if(list.length>0){
        for(let i=0;i<list.length;i++){
          let intensity = list[i].dzIntensity;
          let resultSource = list[i].resultSource;//1:逻辑斯蒂滑坡模型,2:黄土高原模型
          if(resultSource=="2"){
            dzIntensityLegendData.value[5].show = false;//黄土高原模型烈度6-10
          }
          for(let j=0;j<dzIntensityLegendData.value.length;j++){
            if(dzIntensityLegendData.value[j].value==intensity){
              dzIntensityLegendData.value[j].noDataBool = false;//有值
              if(dzIntensitySelect.value==""){
                dzIntensitySelect.value = intensity;
              }
              break;
            }
          }
          if(dzIntensitySelect.value==intensity){
            roadRange.value = list[i].roadRange;
          }
        }
      }
      let dzIntensity = dzIntensitySelect.value;
      if(dzIntensity!=""){
        //评估结果--根据taskId，查询缓冲区内相交部分的道路数据、滑坡计算结果网格（震后交通情况分布图）
        getAllYpgResultSlopeRoadByTaskId(dzIntensity);
      }else{
        //是否显示震后交通情况分布图
        showCountyLandslideBool.value = true;
      }
    });
  });
}

//获取任务信息
getTaskInfo();
//根据任务ID查询任务区域行政区划code列表
//getAllCodeList();

</script>
<style scoped lang="scss">
/*地震影响场|评估结果震级、角度选择面板*/
.earthquakeLevelAngleRadioSelectDiv {
  position: absolute;
  top: 15px;
  right: 30px;
  width: 369px;
  background: #fff;
  padding: 15px;
  box-shadow: 0px 0px 20px rgba(0,0,0,0.2);
  border:1px solid #707070;
  border-radius: 4px;
}

/*评估结果图层图例*/
.new-evaluateResultDiv {
  position: absolute;
  bottom: 0px;
  right: 0px;
  background: #fff;
  box-shadow: 0px 0px 20px rgb(0 0 0 / 20%);
  border: 1px solid #707070;
  border-radius: 4px;
  padding: 5px;
}
.new-evaluateResultDiv div {
  position: relative;
  height: 16px;
  line-height: 16px;
  font-size: 13px;
  margin: 8px;
}
.new-evaluateResultDiv div span {
  line-height: 16px;
  font-size: 13px;
}
.new-evaluateResultDiv div div {
  position: relative;
  top: 2px;
  left: 8px;
  width: 30px;
  height: 14px;
  margin: 0px !important;
  margin-right: 25px !important;
  display: inline-block;
}

/*抗震能力分布图层图例*/
.new-capacityLegendDiv {
  position: absolute;
  bottom: 0px;
  right: 0px;
  width: 170px;
  background: #fff;
  box-shadow: 0px 0px 20px rgb(0 0 0 / 20%);
  border: 1px solid #707070;
  border-radius: 4px;
  padding: 5px;
}
.new-capacityLegendDiv div {
  position: relative;
  height: 16px;
  line-height: 16px;
  font-size: 13px;
  margin: 8px;
}
.new-capacityLegendDiv div span {
  line-height: 16px;
  font-size: 13px;
}
.new-capacityLegendDiv div div {
  position: relative;
  top: 2px;
  left: 8px;
  width: 30px;
  height: 14px;
  margin: 0px !important;
  margin-right: 25px !important;
  display: inline-block;
}

/*基础数据图层选择面板*/
.new-layerSelectDiv {
  position: absolute;
  top: 170px;
  left: 99px;
  width: 256px;
  height: 70px;
  background: #fff;
  box-shadow: 0px 0px 20px rgb(0 0 0 / 20%);
  border: 1px solid #707070;
  border-radius: 4px;
  padding: 18px;
  padding-right: 0px;
}
/*基础数据图例文字工具栏*/
.new-layerLegendDiv {
  position: absolute;
  top:140px;
  right:10px;
  width: 54px;
  height: 150px;
  background: #fff;
  box-shadow: 0px 0px 20px rgba(0,0,0,0.2);
  border:1px solid #707070;
  border-radius: 4px;
  cursor:pointer;
}
.new-layerLegendDiv p {
  padding: 10px;
  margin:0px;
}
.new-layerLegendDiv p img {
  width:25px;
  height:25px;
  margin-left: 3px;
}
.new-layerLegendDiv p span {
  width:32px;
  height:21px;
  font-size: 14px;
  color:#3a385e;
  text-align:center;
  line-height:24px;
  border:0.5px solid #f5f5f5;
}
.new-layerLengendDiv-split {
  width: 32px!important;
  height: 1px!important;
  padding: 0px!important;
  margin: 0px!important;
  margin-left: 10px!important;
  border-top: 1px dashed #6f7ea8;
}
/*基础数据图例*/
.new-legendDiv {
  position: absolute;
  top: 140px;
  right: 70px;
  width: 256px;
  background: #fff;
  box-shadow: 0px 0px 20px rgb(0 0 0 / 20%);
  border: 1px solid #707070;
  border-radius: 4px;
  padding: 5px;
}
.new-legendDiv div {
  position: relative;
  height: 16px;
  line-height: 16px;
  font-size: 13px;
  margin: 8px;
}
.new-legendDiv div span {
  line-height: 16px;
  font-size: 13px;
}
.new-legendDiv div div {
  position: relative;
  top: 2px;
  left: 8px;
  width: 30px;
  height: 14px;
  margin: 0px !important;
  margin-right: 25px !important;
  display: inline-block;
}
/*面*/
.new-legendDiv-polygon {
  position: relative !important;
  left: 0px !important;
  top: 0px !important;
  border:1px solid black;
  background:#fff;
}
/*线*/
.new-legendDiv-line {
  position: relative !important;
  height: 5px !important;
  top: -4px !important;
  left: 0px !important;
}
/*点*/
.new-legendDiv-point {
  position: relative !important;
  left: 8px !important;
  top: 0px !important;
  height: 12px !important;
  width: 12px !important;
  border-radius: 10px !important;
}
/*人口建筑物经济公里格网图例*/
.new-rkgwLegendDiv {
  position: absolute;
  top: 140px;
  right: 340px;
  width: 256px;
  background: #fff;
  box-shadow: 0px 0px 20px rgb(0 0 0 / 20%);
  border: 1px solid #707070;
  border-radius: 4px;
  padding: 5px;
}
.new-rkgwLegendDiv div {
  position: relative;
  height: 16px;
  line-height: 16px;
  font-size: 13px;
  margin: 8px;
}
.new-rkgwLegendDiv div span {
  line-height: 16px;
  font-size: 13px;
}
.new-rkgwLegendDiv div div {
  position: relative;
  top: 2px;
  left: 8px;
  width: 30px;
  height: 14px;
  margin: 0px !important;
  margin-right: 25px !important;
  display: inline-block;
}

/*基础数据下方查看详情面板*/
.new-queryResultDiv {
  position: absolute;
  left:0px;
  right:0px;
  bottom:0px;
  /*height:140px;*/
  height:200px;
  background:#fff;
  z-index: 10;
  border: 1px solid #e4e7ed;
}
.new-queryTableBtn {
  position: absolute;
  left:0px;
  right:0px;
  top:0px;
  height:50px;
  padding:10px;
}
.new-queryTableSpan{
  position: relative;
  top: -32px;
  width: 100%;
  text-align: center;
  font-weight: bold;
  font-size: 18px;
  color: var(--el-color-primary);
  display: inline-block;
  line-height: 32px;
  z-index: -1;
}
.new-queryTableDiv {
  position: absolute;
  left:0px;
  right:0px;
  top:50px;
  bottom:0px;
}

/*设定地震图层图例*/
.new-setEarthquakeLegendDiv {
  position: absolute;
  bottom: 0px;
  left: 0px;
  background: #fff;
  box-shadow: 0px 0px 20px rgb(0 0 0 / 20%);
  border: 1px solid #707070;
  border-radius: 4px;
  padding: 5px;
}
.new-setEarthquakeLegendDiv div {
  position: relative;
  height: 16px;
  line-height: 16px;
  font-size: 13px;
  margin: 8px;
}
.new-setEarthquakeLegendDiv div span {
  line-height: 16px;
  font-size: 13px;
}
.new-setEarthquakeLegendDiv div div {
  position: relative;
  top: 2px;
  left: 8px;
  width: 30px;
  height: 14px;
  margin: 0px !important;
  margin-right: 25px !important;
  display: inline-block;
}
</style>